/*
 * @Author: byron
 * @Date: 2021-10-18 08:35:55
 * @LastEditTime: 2022-05-09 14:55:10
 */

import Vue from 'vue'
import App from './App.vue'
import store from './store/index.js'
import global from './utils/global'

import '@/style/index.less'
import '@/style/overwrite-ele.less'

import router from '@/router'

Vue.use(store)

// 定义全局时间戳处理函数
Vue.filter('timehandle', function (time) {
    console.log(time, 'ceshi')
    console.log(new Date(parseInt(time) + 8 * 3600 * 1000).toJSON())
    return new Date(parseInt(time) + 8 * 3600 * 1000).toJSON()
    // .substr(0, 16)
    // .replace('T', ' ')
})

Vue.config.productionTip = false

// 全局注册组件
import icon from '@/base/icon/index'
Vue.use(icon)
import toolbar from '@/base/toolbar/index'
Vue.use(toolbar)
import top from '@/base/top/index'
Vue.use(top)
import logo from '@/base/logo/index'
Vue.use(logo)
import None from '@/base/none/index'
Vue.use(None)

import messageBox from '@/components/message/index'
Vue.use(messageBox)

Vue.use(global)

// import VMdEditor from '@kangc/v-md-editor';
// import '@kangc/v-md-editor/lib/style/base-editor.css';
// import githubTheme from '@kangc/v-md-editor/lib/theme/github.js';
// import '@kangc/v-md-editor/lib/theme/style/github.css';

// // highlightjs
// import hljs from 'highlight.js';

// VMdEditor.use(githubTheme, {
//     Hljs: hljs,
// });

// Vue.use(VMdEditor);

import VueMarkdownEditor from '@kangc/v-md-editor'
import '@kangc/v-md-editor/lib/style/base-editor.css'
import vuepressTheme from '@kangc/v-md-editor/lib/theme/vuepress.js'
import '@kangc/v-md-editor/lib/theme/style/vuepress.css'

import Prism from 'prismjs'

VueMarkdownEditor.use(vuepressTheme, {
    Prism,
})

import createCopyCodePlugin from '@kangc/v-md-editor/lib/plugins/copy-code/index'
import '@kangc/v-md-editor/lib/plugins/copy-code/copy-code.css'
import createTodoListPlugin from '@kangc/v-md-editor/lib/plugins/todo-list/index'
import '@kangc/v-md-editor/lib/plugins/todo-list/todo-list.css'

VueMarkdownEditor.use(createTodoListPlugin())

VueMarkdownEditor.use(createCopyCodePlugin())

Vue.use(VueMarkdownEditor)

//挂载Vue Router
new Vue({
    render: (h) => h(App),
    router,
    store,
}).$mount('#app')
